﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using System.Web;

namespace YouHP.Pages.SymptomHistory
{
    public class List : YouHP.Pages.PatientBasePage
    {

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (ErrorCount > 0) return;

            if (IsPost) HandlePost();
            else HandleGet();
        }

        protected List<SymptomHistoryInfo> SymptomHistoryList;
        protected SymptomInfo SymData;
        protected int PageCount;
        protected int PageIndex;
        protected int PageSize = 10;
        protected string PagingString = "";
        protected int DataCount = 0;

        protected int GraphHeight = 140;
        protected string GraphPath;

        protected new void HandleCommon()
        {
            this.AddLocation("症状记录", "/SymptomHistory/Index.aspx");
            this.AddLocation("症状详情", "");
            this.SetTitle("症状详情");
        }

        protected new void HandlePost()
        {

        }

        protected new void HandleGet()
        {
            int symid = RequestTools.GetQueryInt("symid", 0);
            if (symid <= 0)
            {
                this.AddErrLine("无效的症状");
                return;
            }

            PageIndex = RequestTools.GetQueryInt("page", 1);

            SymData = SymptomBLL.Instance.GetSymptomInfo(symid);
            if (SymData.Id <= 0)
            {
                this.AddErrLine("无效的症状");
                return;
            }

            SymptomHistoryList = PatientSymptomBLL.Instance.GetSymptomHistoryList(
                PrData.Id, SymData.Id, PageSize, PageIndex, out DataCount);

            PageCount = Utils.GetPageCount(DataCount, PageSize);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            PagingString = this.GetPagingString(
                PageIndex,
                PageCount,
                "/SymptomHistory/List.aspx" + query, "page");


            TempUrl = "/SymptomHistory/SymptomAjax.aspx?symid=" + SymData.Id;
            GraphPath = GetUrl(TempUrl);
        }
    }
}